<%@ Page Title="Edir Vendors" Language="C#" MasterPageFile="~/Pages/admin/adminMaster.Master" AutoEventWireup="true" CodeBehind="EditVendors.aspx.cs" Inherits="WarehouseWebAPP.Pages.admin.Edit_Entities.EditVendors" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <table class="style1">
        <tr>
            <td>
                <table class="style1">
                    <tr>
                        <td>
                            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                                <ContentTemplate>
                                    <asp:Label ID="ErrorLabel" runat="server" BackColor="#FFFFCC" 
                                        ForeColor="Maroon" Height="24px" 
                                        Text="Error: The entity can't be deleted from the following reason: This entity is a FK of other entity." 
                                        Visible="False"></asp:Label>
                                    <asp:GridView ID="VendorsGridView" runat="server" AllowPaging="True" 
                                        AutoGenerateColumns="False" CellPadding="4" DataKeyNames="vendor_num" 
                                        DataSourceID="VendorObjectDataSource" ForeColor="#333333" GridLines="None" 
                                        onselectedindexchanged="VendorsGridView_SelectedIndexChanged" Width="300px">
                                        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                                        <Columns>
                                            <asp:CommandField ShowSelectButton="True" />
                                            <asp:BoundField DataField="vendor_num" HeaderText="vendor_num" ReadOnly="True" 
                                                SortExpression="vendor_num" Visible="False" />
                                            <asp:BoundField DataField="vendor_name" HeaderText="Vendor Name" 
                                                SortExpression="vendor_name" />
                                        </Columns>
                                        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                                        <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                                        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" 
                                            HorizontalAlign="Left" />
                                        <EditRowStyle BackColor="#999999" />
                                        <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                                    </asp:GridView>
                                    <asp:DetailsView ID="VendorsDetailsView" runat="server" 
                                AutoGenerateRows="False" CellPadding="4" DataKeyNames="vendor_num" 
                                DataSourceID="VendorObjectDataSource" 
    ForeColor="#333333" GridLines="None" 
                                Height="50px" Width="309px" 
                                
    onitemdeleting="VendorsDetailsView_ItemDeleting">
                                        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                        <CommandRowStyle BackColor="#E2DED6" Font-Bold="True" />
                                        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                                        <FieldHeaderStyle BackColor="#E9ECF1" Font-Bold="True" />
                                        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                                        <Fields>
                                            <asp:BoundField DataField="vendor_num" HeaderText="vendor_num" ReadOnly="True" 
                                        SortExpression="vendor_num" Visible="False" />
                                            <asp:TemplateField HeaderText="Vendor Name" SortExpression="vendor_name">
                                                <EditItemTemplate>
                                                    <asp:TextBox ID="NameTextBox" runat="server" Text='<%# Bind("vendor_name") %>'></asp:TextBox>
                                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                                                ControlToValidate="NameTextBox" ErrorMessage="*"></asp:RequiredFieldValidator>
                                                    <asp:CustomValidator ID="CustomValidator1" runat="server" 
                                                ControlToValidate="NameTextBox" ErrorMessage="Already Exist" 
                                                onservervalidate="CustomValidator1_ServerValidate"></asp:CustomValidator>
                                                </EditItemTemplate>
                                                <InsertItemTemplate>
                                                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("vendor_name") %>'></asp:TextBox>
                                                </InsertItemTemplate>
                                                <ItemTemplate>
                                                    <asp:Label ID="VendorLabel" runat="server" Text='<%# Bind("vendor_name") %>'></asp:Label>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
                                        </Fields>
                                        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                        <EditRowStyle BackColor="#999999" />
                                        <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                                    </asp:DetailsView>
                                </ContentTemplate>
                            </asp:UpdatePanel>
                        </td>
                    </tr>
                    <tr>
                        <td>
                <asp:ObjectDataSource ID="VendorObjectDataSource" runat="server" DeleteMethod="VendorDelete" 
                    SelectMethod="VendorGet" TypeName="WarehouseWebAPP.code.BLL.VendorBLL" 
                    UpdateMethod="VendorUpdate">
                    <UpdateParameters>
                        <asp:Parameter DbType="Guid" Name="vendor_num" />
                        <asp:Parameter Name="vendor_name" Type="String" />
                    </UpdateParameters>
                </asp:ObjectDataSource>
                        </td>
                    </tr>
                    </table>
            </td>
        </tr>
        </table>
</asp:Content>
